﻿using Anke.SHManage.MSSQLDAL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class PrintMaintainPlanWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                Data_Binding();
            }
        }

        private void Data_Binding()
        {

                    
            DateTime MaintainDateStart = Convert.ToDateTime(Request.QueryString["MaintainDateStart"]);
            DateTime MaintainDateEnd = Convert.ToDateTime(Request.QueryString["MaintainDateEnd"]);
            
            string txtDayKM = Request.QueryString["txtDayKM"];

  
            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/PrintMaintainPlan.rdlc");
            CMTJDAL dal = new CMTJDAL();

            DataTable dt = dal.getAllambMaintainPrint(MaintainDateStart, MaintainDateEnd, txtDayKM);
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));

            this.ReportViewer1.LocalReport.Refresh();

        }
    }
}